fix: add types condition to package.json exports field#1081
Merged
robertsLando merged 1 commit intomainfrom Mar 9, 2026
Merged
fix: add types condition to package.json exports field#1081robertsLando merged 1 commit intomainfrom
robertsLando merged 1 commit intomainfrom
Conversation
When using TypeScript with moduleResolution set to "node16", "nodenext", or "bundler", the compiler resolves types through the exports field and ignores the top-level "types" entry. This caused TS2305 errors like: Module '"aedes"' has no exported member 'Aedes'. Adding the "types" condition inside the exports map fixes resolution for all moduleResolution strategies. Closes #1080 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1081 +/- ##
=======================================
Coverage 99.47% 99.47%
=======================================
Files 15 15
Lines 1921 1921
=======================================
Hits 1911 1911
Misses 10 10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1 task
robertsLando
added a commit
that referenced
this pull request
Mar 27, 2026
## Summary - Adds `.js` extensions to all relative imports in `.d.ts` type definition files - Fixes TypeScript `moduleResolution: "node16"` failing to resolve types when importing `aedes` Closes #1082 ## Details With `moduleResolution: "node16"` and `"type": "module"`, TypeScript strictly requires file extensions on relative imports. PR #1081 added the `types` condition to `package.json` exports, allowing TypeScript to find the entry `aedes.d.ts`, but the internal relative imports within the `.d.ts` files still lacked `.js` extensions, causing resolution failures. **Files changed:** - `aedes.d.ts` — entry point re-exports - `types/client.d.ts` — imports from `packet` and `instance` - `types/instance.d.ts` — imports from `client` and `packet` - `types/packet.d.ts` — imports from `client` - `test/types/aedes.test-d.ts` — test import from `types/packet` ## Test plan - [x] `npm run test:typescript` (tsd) passes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
typescondition to theexportsfield inpackage.jsonso TypeScript can resolve type declarations when usingmoduleResolution: "node16","nodenext", or"bundler"TS2305: Module '"aedes"' has no exported member 'Aedes'because TypeScript ignores the top-level"types"field when theexportsfield is presentCloses #1080
Test plan
npm run test:typescript(tsd) passesnpm run lintpasses🤖 Generated with Claude Code